
#define CRC8INIT	0x00
#define CRC8POLY	0x18              //0X18 = X^8+X^5+X^4+X^0
unsigned char GetVerify_Sum( unsigned char* pBuff,unsigned int Count )
{
	unsigned char sum,i;
	sum=0;
	for(i=0;i<Count;i++)
	{
		sum=(unsigned char)(sum+pBuff[i]);
	}
	return sum;
}

unsigned char GetVerify_CRC8( unsigned char* pBuff, unsigned int Count )
{
	unsigned char crc;
	unsigned int i;
	unsigned char bit_counter;
	unsigned char data;
	unsigned char feedback_bit;

	crc = CRC8INIT;

	for(i = 0; i != Count; i++)
	{
		data = pBuff[i];
		bit_counter = 8;
		do 
		{ 
			feedback_bit = (crc ^ data) & 0x01;
			if ( feedback_bit == 0x01 ) 
				crc = crc ^ CRC8POLY;
			crc = (crc >> 1) & 0x7F;
			if ( feedback_bit == 0x01 ) 
				crc = crc | 0x80;
			data = data >> 1;
			bit_counter--;
		}while (bit_counter > 0);
	}
	return crc;
}
